//
//  BindingExampleView.swift
//  TanTan_Kotlin
//
//  Created by EDY on 5/23/25.
//

import SwiftUI

struct BindingExampleView:View {
    @State private var isOn = false
    var body: some View {
        VStack {
            Text(isOn ? "开" : "关")
                .font(.largeTitle)
            BindingToggleView(isOn: $isOn)
        }
    }
}


struct BindingToggleView : View {
    @Binding var isOn: Bool
    var body: some View {
        Toggle("开关", isOn: $isOn)
            .padding()
    }
}

#Preview {
   BindingExampleView()
}
